package com.quanyan.place.web.api;

import java.util.List;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.quanyan.api.APIResponse;
import com.quanyan.common.Plugin.PageObj;
import com.quanyan.place.client.BizPlaceClient;
import com.quanyan.place.entity.apireq.ReqAppUserSearchVo;
import com.quanyan.place.entity.apireq.ReqPlaceOrderDetailVo;
import com.quanyan.place.entity.apireq.ReqPlaceOrderVo;
import com.quanyan.place.entity.apiresp.RespBizPlaceBaseInfo;
import com.quanyan.place.entity.apiresp.RespPlaceOrderInfo;

/**
 * 商家端客户端接口
 * Created by zhaohui on 2016/5/31.
 */
@RestController
@RequestMapping("/api/place/shops")
public class ApiPlaceBizController {
   
    @Autowired
    BizPlaceClient bizPlaceClient;
    
    
    /**
     * 选择场馆
     * @return
     */
    @RequestMapping(value = "/choosePlace" ,method = RequestMethod.POST,produces = {"application/json; charset=UTF-8"})
    @ResponseBody
    public APIResponse choosePlace(@RequestBody @Valid ReqAppUserSearchVo reqAppUserSearchVo,BindingResult bindingResult){
        PageObj<List<RespBizPlaceBaseInfo>> respPlace = bizPlaceClient.choosePlace(reqAppUserSearchVo);
        return APIResponse.returnSuccess(respPlace);
    }

    /**
     * 查看场馆订单的列表
     * @param reqPlaceOrderVo
     * @return
     */
    @RequestMapping(value = "/orders" ,method = RequestMethod.POST,produces = {"application/json; charset=UTF-8"})
    @ResponseBody
    public APIResponse placeOrders(@RequestBody @Valid ReqPlaceOrderVo reqPlaceOrderVo){
        PageObj<List<RespPlaceOrderInfo>> respPlace = bizPlaceClient.placeOrder(reqPlaceOrderVo);
        return APIResponse.returnSuccess(respPlace);
    }

    /**
     * 订单详情
     * @return
     */
    @RequestMapping(value = "/orderDetail" ,method = RequestMethod.POST,produces = {"application/json; charset=UTF-8"})
    @ResponseBody
    public APIResponse placeOrderDetail(@RequestBody @Valid ReqPlaceOrderDetailVo reqPlaceOrderDetailVo){
        return bizPlaceClient.placeOrderDetailClient(reqPlaceOrderDetailVo);
    }


}
